package com.data.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.data.dao.DataDao;
import com.data.entity.DataEntity;
import com.data.service.DataService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.common.utils.PageUtils;



@Service("dataService")
public class DataServiceImpl extends ServiceImpl<DataDao, DataEntity> implements DataService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        //分页参数
        long curPage = 1;
        long limit = 10;

        if(params.get("page") != null){
            curPage = Long.parseLong((String)params.get("page"));
        }
        if(params.get("limit") != null){
            limit = Long.parseLong((String)params.get("limit"));
        }
        Page<DataEntity> page = new Page<>(curPage, limit);
        IPage<DataEntity> ipage = baseMapper.selectPage(page,new QueryWrapper<>());

        return new PageUtils(ipage);
    }

}